package cn.iocoder.yudao.module.product.spu.vo;

import cn.iocoder.yudao.framework.validation.InEnumValue;
import cn.iocoder.yudao.module.api.dine.enums.DineAttributeEnum;
import cn.iocoder.yudao.module.api.product.sku.dto.PriceRespDTO;
import cn.iocoder.yudao.module.api.product.spu.enums.ProductPriceModeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@Schema(description = "用户 APP - 产品 SPU Response VO")
@Data
public class AppProductSpuSimpleRespVO extends PriceRespDTO {

    @Schema(description = "店铺编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long shopId;

    @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉小短袖")
    private String name;

    @Schema(description = "产品封面图", requiredMode = Schema.RequiredMode.REQUIRED)
    private String picUrl;

    @Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
    private Integer stock;

    @Schema(description = "单位名称")
    private String unitName;

    @Schema(description = "成本价，单位使用：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
    @JsonIgnore
    private int costPrice; // 不返回成本价给前端用户看到

    @Schema(description = "标签，英文逗号分隔")
    private List<String> labels;

    @Schema(description = "菜肴属性：0-无、1-主食、2-荤菜、3-素菜、4-汤、5-调料、6-饮品、7-水果、20-锅底、50-套餐、98-餐盒、99-备注")
    @InEnumValue(DineAttributeEnum.class)
    private Integer dishAttribute;
    @Schema(description = "菜肴属性：0-无、1-主食、2-荤菜、3-素菜、4-汤、5-调料、6-饮品、7-水果、20-锅底、50-套餐、98-餐盒、99-备注")
    private String dishAttributeName;

    @SuppressWarnings("unused")
    public String getDishAttributeName() {
        if (dishAttributeName == null) {
            return DineAttributeEnum.getByValue(getDishAttribute()).getName();
        }
        return dishAttributeName;
    }

    @Schema(description = "计价模式：1-按单品计价、2-按称量计价")
    @InEnumValue(ProductPriceModeEnum.class)
    private Integer priceMode;


}
